<?php

class Adept_Template_Tag extends Adept_Template_Node 
{

    protected $tagInfo;
    
    protected $attributes = array();
    
    public function hasAttribute($name)
    {
    	return isset($this->attributes[$name]);
    }
    
    /**
     * @param string $name
     * @return Adept_Template_Attribute_Abstract
     */
    public function getAttribute($name)
    {
        return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
    }
    
    public function getAttributeValue($name) 
    {
        return (!is_null($attribute = $this->getAttribute($name))) ?
            $attribute->getValue() : null;
    }
    
    public function getBoolAttributeValue($name, $default = false) 
    {
        if (!$this->hasAttribute($name)) {
            return $default;
        }
        $value = $this->getAttributeValue($name);
        return !in_array(strtolower($value), array('false', '0', '', 'null', 'no', 'f'));
    }
    
    public function getAttributes() 
    {
        return $this->attributes;
    }
    
    public function setAttributes($attributes) 
    {
        $this->attributes = $attributes;
    }
    
    public function getTagInfo() 
    {
        return $this->tagInfo;
    }
    
    public function setTagInfo($tagInfo) 
    {
        $this->tagInfo = $tagInfo;
    }
    
}
